<template>
  <!-- 推荐位 -->
  <div class="recommend">
    <template v-if="size == 'height'">
      <div class="itemRecom" v-for="(item,index) in recommendList" :key="'s'+index">
        <div class="image"><img :src="item.img"></div>
        <div class="tit">{{item.title.length>8?item.title=item.title.substring(0,8)+"...":item.title}}</div>
      </div>
    </template>
    <template v-else-if="size == 'width'">
      <div class="itemRecom" v-for="(item,index) in recommendList" :key="'s'+index">
        <div class="imgs"><img :src="item.img"></div>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  props: {
    size:{
      type:String,
      default:'height'
    },
    recommendList:{
      type: Array,
      default:() =>[]
    }
  },
  data () {
    return {
      
    }
  },
  computed: {},
  watch: {},
  created () {},
  mounted () {},
  updated () {},
  methods: {},
  filters: {},
}
</script>

<style lang="less" scoped>
.recommend {
  display: flex;
  .itemRecom{
    margin-left: 35px;
    position: relative;
    &:nth-child(1){
      margin-left: 0;
    }
    .image{
      width: 165px;
      height: 220px;
    }
    .tit{
      width: 100%;
      text-align: center;
      position: absolute;
      bottom: 0;
      padding: 8px 5px;
      background-color: rgb(0,0,0,.5);
    }
    .imgs{
      width: 165px;
      height: 165px;
    }
  }
}
</style>